import request, {sign} from '@/utils/request';
const obj = {};

obj.getFunctionList = function (data) {
  return request({
    url: `${sign}/function/list`,
    method: 'get',
    data
  });
};

// 添加同级或子级
obj.addFunction = function (data) {
  return request({
    url: `${sign}/function/add`,
    method: 'post',
    data
  });
};

// 功能上下架
obj.functionUpDownStand = function (data) {
  return request({
    url: `${sign}/function/upDownStand`,
    method: 'post',
    data
  });
};

// 功能删除
obj.deleteFunction = function (data) {
  return request({
    url: `${sign}/function/delete`,
    method: 'post',
    data
  });
};

// 功能排序
obj.sortFunction = function (data) {
  return request({
    url: `${sign}/function/sort?idDown=${data.idDown}&idUp=${data.idUp}`,
    method: 'post'
  });
};

// 修改功能
obj.updateFunction = function (data) {
  return request({
    url: `${sign}/function/update`,
    method: 'post',
    data
  });
};

export default obj;
